const app = getApp()
const promisify = require("../../utils/promisify")

Page({
  data: {
    userId: undefined,
    token: undefined,
    activities: []
  },
  onLoad: function (data) {
    let that = this
    that.setData({
      userId: app.globalData.userId,
      token: app.globalData.token
    })
    promisify(wx.request)({
      url: `https://www.cumthing.world/cumthing/activity-apply/list` + app.ToParams({
        userId: that.data.userId
      }),
      method: "GET",
      header: {
        'Authorization': app.globalData.token
      },
    }).then(
      data => {
        if (data.data.code === 0) {
          console.log(data.data.data)
          that.setData({
            activities: data.data.data
          })
        }
      }
    )
  }
})